package com.example.apipassenger.remote;

import com.example.internalcommon.dto.PassengerUser;
import com.example.internalcommon.dto.ResponseResult;
import com.example.internalcommon.request.VerificationCodeDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @Author lyra
 * @Date 2023/4/5 11:21
 **/
@FeignClient("service-passenger-user")
public interface ServicePassengerUserClient {

    @RequestMapping(method = RequestMethod.POST, value = "/user")
    ResponseResult loginOrRegister(@RequestBody VerificationCodeDTO verificationCodeDTO);

    /**
     * 使用feign的问题
     * 如果请求的参数是@RequestBody的形式,它会自动将get转为post请求
     * @param Phone
     * @return
     */
    @RequestMapping(method = RequestMethod.GET,value = "/user/{phone}")
    ResponseResult<PassengerUser> getUserByPhone(@PathVariable("phone") String Phone);

}
